package com.kaishengit.pojo;

import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import com.kaishengit.util.DateUtil;

@Entity
@Table(name="t_issues")
public class Issues {
	@Id
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	private int id;
	private String title;
	private String content;
	private int type;
	private String createtime;
	private String state;
	
	@ManyToOne(cascade=CascadeType.PERSIST)
	@JoinColumn(name="createuserid")
	private User createuser;
	
	@ManyToOne(cascade=CascadeType.PERSIST)
	@JoinColumn(name="workuserid")
	private User workuser;
	
	@ManyToOne(cascade=CascadeType.PERSIST)
	@JoinColumn(name="projectid")
	private Project project;
	
	@ManyToOne(cascade=CascadeType.PERSIST)
	@JoinColumn(name="milestoneid")
	private Milestone milestone;
	
	@OneToMany(mappedBy="issues",cascade=CascadeType.PERSIST)
	private List<Talk> talks;
	
	
	public int getId() {
		return id;
	}
	public void setId(int id) {
		this.id = id;
	}
	public String getTitle() {
		return title;
	}
	public void setTitle(String title) {
		this.title = title;
	}
	public String getContent() {
		return content;
	}
	public void setContent(String content) {
		this.content = content;
	}
	public int getType() {
		return type;
	}
	public void setType(int type) {
		this.type = type;
	}
	public String getCreatetime() {
		return DateUtil.friendlyTime(DateUtil.stringToDate(createtime));
	}
	public void setCreatetime(String createtime) {
		this.createtime = createtime;
	}
	public String getState() {
		return state;
	}
	public void setState(String state) {
		this.state = state;
	}
	public User getCreateuser() {
		return createuser;
	}
	public void setCreateuser(User createuser) {
		this.createuser = createuser;
	}
	public User getWorkuser() {
		return workuser;
	}
	public void setWorkuser(User workuser) {
		this.workuser = workuser;
	}
	public Project getProject() {
		return project;
	}
	public void setProject(Project project) {
		this.project = project;
	}
	public Milestone getMilestone() {
		return milestone;
	}
	public void setMilestone(Milestone milestone) {
		this.milestone = milestone;
	}
	public void setTalks(List<Talk> talks) {
		this.talks = talks;
	}
	public List<Talk> getTalks() {
		return talks;
	}
	
	
}
